<?php

//付款方式
class ShoppayAction extends Action
{
	public function preMethod()
	{
		R("Mayijie/check_admin");
		$perm_key = session('admin_perm');
		$perm_arr = explode(",",$perm_key);
		if(!in_array(2,$perm_arr)){
			$this->error("无权操作");
		}
	}

	public function index(){
		$Pay=M('Payment');
		$this->pay=$Pay->select();
		$this->display();
	}

	public function add(){
		$this->display();
	}

	public function add_pay(){
		$Pay=M('Payment');
		$data['pay_name']=$this->_post('name');
		$data['type']=$this->_post('type');
		$data['intro']=$this->_post('intro');
		$data['is_use']=$this->_post('is_ac');

		if(empty($data['pay_name'])) $this->error("不得为空！");

		$re=$Pay->add($data);
		if($re){
			$this->success("添加成功！");
		}else{
			$this->error("添加失败！");
		}
	}


}